package com.foruo.demo.spring;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestMe {

    public static void main(String[] args){
        /** 原始用法 */
        Tool tool = new Gun();
        Person person = new Person(tool);
        person.execute();

        /** 依赖注入 */
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("config.xml");
        Person personNew = (Person)context.getBean("person");
        personNew.execute();
        context.close();
    }
}
